<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>分配学生</title>
</head>
<body>
    <h1 th:text="${'教师：' + teacher.name + ' 的学生分配'}"></h1>
    
    <h2>已分配学生</h2>
    <table border="1">
        <tr>
            <th>姓名</th>
            <th>Java成绩</th>
            <th>头像</th>
        </tr>
        <tr th:each="student : ${assignedStudents}">
            <td th:text="${student.name}"></td>
            <td th:text="${student.javaScore}"></td>
            <td>
                <img th:if="${student.photo}" th:src="@{'/photos/' + ${student.photo}}" style="width:100px">
            </td>
        </tr>
    </table>
    
    <h2>未分配学生</h2>
    <table border="1">
        <tr>
            <th>姓名</th>
            <th>Java成绩</th>
            <th>头像</th>
            <th>操作</th>
        </tr>
        <tr th:each="student : ${unassignedStudents}">
            <td th:text="${student.name}"></td>
            <td th:text="${student.javaScore}"></td>
            <td>
                <img th:if="${student.photo}" th:src="@{'/photos/' + ${student.photo}}" style="width:100px">
            </td>
            <td>
                <a th:href="@{/students/assign/{teacherId}/{studentId}(teacherId=${teacher.id},studentId=${student.id})}">分配</a>
                <a th:href="@{/students/upload/{id}(id=${student.id})}">上传头像</a>
            </td>
        </tr>
    </table>
    <br>
    <a th:href="@{/teachers/}">返回列表</a>
</body>
</html> 